package com.scau.RBAC.service;

import com.scau.RBAC.model.entity.User;
import com.scau.RBAC.model.entity.Role;
import com.scau.RBAC.model.entity.Permission;
import java.util.List;

/**
 * RBAC服务接口，作为业务门面，提供统一的业务逻辑入口
 */
public interface RBACService {
    // 认证授权相关
    User login(String username, String password);
    void logout(Long userId);
    boolean checkPermission(Long userId, String permissionCode);
    boolean checkRole(Long userId, String roleCode);

    // 用户相关操作
    User createUser(User user, List<String> roleCodes);
    User updateUser(User user, List<String> roleCodes);
    List<Role> getUserRoleList(Long userId);
    List<Permission> getUserPermissionList(Long userId);

    // 角色相关操作
    Role createRole(Role role, List<String> permissionCodes);
    Role updateRole(Role role, List<String> permissionCodes);
    List<Permission> getRolePermissionList(Long roleId);

    // 权限相关操作
    List<Permission> getPermissionTree();
    boolean validateUserAccess(Long userId, String resourcePath);

    // 初始化操作
    void initializeRBAC();
    boolean isInitialized();
}